#ifndef _NEPTUNER_SCUBA_H_
#define _NEPTUNER_SCUBA_H_

#include<string>
#include<vector>
#include "Scope.h"

#include "Scubserver.h"
#include "Scubuddy.h"

#include "Reader.h"
#include "Tokenizer.h"
#include "Symbolyzer.h"
#include "Location.h"

class Scuba
{
public:
	enum Status
	{
		eScubaDoneNone,
		eScubaDoneRead,
		eScubaDoneTokenize,
		eScubaDoneParse
	};

    Scope*				m_pxCurrentScope;
    std::vector<Scope*> m_apxScope;
	Status				m_eStatus;

	Reader				m_xReader;
	Tokenizer			m_xTokenizer;
	Symbolyzer*			m_pxSymbolyzer;
	Scubserver*			m_pxScubserver;

    virtual void enterScope(Scope* inScope);
    virtual void exitScope(void);

	std::string			m_sFileName;
	Location			m_xLocation;

public:
	void dive(std::string in_sFileName, bool bReadFile=true, bool bTokenize=true, bool bParse=true);
	void walk(Scubuddy& in_xScubuddy);
    void print();
    void setObserver(Scubserver* inScubserver);
	void setFileName(std::string in_sFileName, int in_nLineNumber = 1);
	
	int getNumberOfLines();
	int getNumberOfTokens();
	
    Scuba(std::string sFileName="");
    ~Scuba(void);

private:
    void feed(Token& inToken);
	void walkScope(Scubuddy& in_rxScubuddy, Scope* in_pxScope);
};

#endif
